/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package merlion.frm.ccm.session;

import java.util.List;
import javax.ejb.Lock;
import javax.ejb.LockType;
import javax.ejb.Remote;
import javax.ejb.Schedule;
import merlion.crm.slcm.entity.Customer;
import merlion.crm.sopm.entity.SalesOrder;
import merlion.frm.ccm.entity.CreditAccount;
import merlion.frm.ccm.entity.CreditGroup;

/**
 *
 * @author zhiqi chen
 */

@Remote
public interface CCSessionBeanRemote {
    
    

    Boolean checkExistCreditGroupByTitle(String title);

//    @Schedule(dayOfMonth = CCSessionBean.EVERY, month = CCSessionBean.EVERY, year = CCSessionBean.EVERY, second = CCSessionBean.ZERO, minute = CCSessionBean.ZERO, hour = CCSessionBean.EVERY)
    @Lock(value = LockType.READ)
    void checkUnpaidInvoices();

    CreditAccount createCreditAccount(CreditAccount ca);

    CreditGroup createCreditGroup(CreditGroup cg);

    boolean creditCheck(SalesOrder so);

    List<CreditGroup> getAllCreditGroup();

    CreditGroup getCreditGroupById(Long id);

    CreditAccount getCustomerCreditAccount(Customer customer);

    List<Customer> getCustomersNoCreditAccount();

    List<Customer> getCustomersWithCreditAccount();

    CreditGroup getNextCreditGroupDs(CreditGroup cg);

    CreditGroup getNextCreditGroupWs(CreditGroup cg);

    CreditGroup getPreviousCreditGroupDs(CreditGroup cg);

    CreditGroup getPreviousCreditGroupWs(CreditGroup cg);

    boolean removeCreditGroupById(Long id);

    CreditGroup updateCreditGroup(CreditGroup cg);
    
    Customer getCustomer(Long id);
    
}
